package com.itheima.service.impl;

import com.itheima.dao.FileDao;
import com.itheima.domain.FilePojo;
import com.itheima.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class FileServiceImpl implements FileService {
    @Autowired
    private FileDao fileDao;

    @Override
    public Boolean save(FilePojo filePojo) {

        return fileDao.save(filePojo)>0;
    }

    @Override
    public Boolean update(FilePojo filePojo) {

        return fileDao.update(filePojo)>0;
    }

    @Override
    public Boolean delete(Integer fid) {
        return fileDao.delete(fid)>0;
    }

    @Override
    public FilePojo getById(Integer fid) {
        FilePojo filePojo = fileDao.getById(fid);
        return filePojo;
    }

    @Override
    public List<FilePojo> getAll() {
        List<FilePojo> filePojoList = fileDao.getAll();
        return filePojoList;
    }

    @Override
    public List<FilePojo> selectAllFiles(String filename) {
        List<FilePojo> filePojoList = fileDao.selectAllFiles(filename);
        return filePojoList;
    }
}
